﻿using MyCode.Project.Domain.Businesses.BillKeeping;
using MyCode.Project.Domain.Message.Act.SalesSheetPay;
using MyCode.Project.Domain.Message.Request.CouponActivity;
using MyCode.Project.Domain.Message.Request.Message;
using MyCode.Project.Domain.Message.Response.CouponActivity;
using MyCode.Project.Domain.Message.Response.SalesSheet;
using MyCode.Project.Domain.Model;
using System;
using System.Collections.Generic;

namespace MyCode.Project.Services
{
    /// <summary>
    /// 账单记录模块 相关服务
    /// </summary>
    public interface IBillKeepingService 
    {
        /// <summary>
        /// 库存记账
        /// </summary>
        /// <param name="dto">库存记账 数据传输对象</param>
        void Stock(StockBillKeepingDto dto);

        /// <summary>
        /// 会员服务数量记账
        /// </summary>
        /// <param name="dto">会员服务数量记账 数据传输对象</param>
        void MemberServiceBook(MemberServiceBookBillKeepingDto dto,Guid MerchantId);

        /// <summary>
        /// 会员帐户金额记账
        /// </summary>
        /// <param name="dto">会员帐户金额记账 数据传输对象</param>
        void MemberAccount(MemberAccountBillKeepingDto dto, Guid MerchantId);

        /// <summary>
        /// 会员积分记账。应用场景：充值、预售、销售
        /// </summary>
        /// <param name="dto">会员积分记账 数据传输对象</param>
        /// <param name="ifReturnSheet">是否退货退款，遇到积分不够不拦截报错</param>
        void MemberIntegral(MemberIntegralBillKeepingDto dto, bool ifReturnSheet = false);

        /// <summary>
        /// 批量库存记账，暂时只允许盘盈盘亏审核使用，其他功能请不要调用
        /// </summary>
        /// <param name="dtolist">库存记账 数据传输对象数组</param>

        void BatchStock(List<StockBillKeepingDto> dtolist, Guid merchantId,string UserName);

        /// <summary>
        /// 设置会员到店时间信息
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="shopId"></param>
        void SetMemberShopTime(Guid memberId, Guid shopId, Guid MerchantId);

        /// <summary>
        /// 设置会员到店服务时间信息
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="shopId"></param>
        void SetMemberServiceTime(Guid memberId, Guid shopId, Guid MerchantId);

        /// <summary>
        /// 卡券数量登记
        /// </summary>
        /// <param name="dto"></param>
        List<MemberServiceBookBillKeepingDto> CardBook(CardBookDto dto);


        /// <summary>
        /// 计算一条订单的业绩
        /// </summary>
        /// <param name="act"></param>
        void SetMemberExpenses(Object act1);

        /// <summary>
        /// 核销门票
        /// </summary>
        /// <param name="sheetId"></param>
        void ChangeActivityStatus(Guid sheetId);

        /// <summary>
        /// 批量计算时间范围内的所有订单的业绩中间报表数
        /// </summary>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        void BatchSetMemberExpenses(DateTime begin, DateTime end);

        /// <summary>
        /// 清零指定加盟商的积分
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="days">截止日期</param>
        ///  <param name="shopId">指定店铺</param>
        void ClearIntegralByCustomerId(Guid? customerId, DateTime? days = null, Guid? shopId = null);

        /// <summary>
        /// 修改获奖记录的兑换状态为已兑换
        /// </summary>
        /// <param name="sheetId"></param>
        void ChangeMemberPrizeItem(Guid sheetId);

        /// <summary>
        /// 计算分销佣金
        /// </summary>
        /// <param name="id"></param>
        void CalculateCommission(string id);
        /// <summary>
        /// 调度计算业绩新老客
        /// </summary>
        /// <param name="json"></param>
        void TaskSetRpShopMemberAnalyzeLog2207(string json);

        /// <summary>
        ///分析一条订单是首单还是复购或者都不是
        /// </summary>
        /// <param name="staMemberExpensesRecord"></param>
        StaMemberExpensesRecord SetShouDanFuGou(StaMemberExpensesRecord staMemberExpensesRecord);

        /// <summary>
        /// 刷业绩记录是否护肤类服务字段
        /// </summary>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        void SetHuFu(DateTime begin, DateTime end);

        /// <summary>
        /// 临时的刷业绩计算结果的支付字段数值,修复BUG记录
        /// </summary>
        /// <param name="days"></param>
        /// <param name="end"></param>
        void SaveReturnSheetTemp(DateTime days, DateTime end);


        /// <summary>
        /// 恢复指定加盟商的被清零的会员积分
        /// </summary>
        /// <param name="customerId"></param>

        void ResumeMemberIntegral(Guid? customerId, DateTime begin, DateTime end );

        /// <summary>
        /// 传店铺ID和加盟商ID，获得对应的同规则店铺ID数组
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="shopId"></param>
        /// <returns></returns>
        List<Guid> GetShopAssetRules(Guid? customerId, Guid shopId);

        /// <summary>
        /// 获取需要记账的积分数(如果返回0，不需要记账)
        /// </summary>
        /// <returns></returns>
        int GetIntegralToBook(Guid merchantId, Guid memberGradeId, decimal totalAmount);

        /// <summary>
        /// 补记录计算一条订单的业绩
        /// </summary>
        /// <param name="act"></param>
         
         void BuLuMemberExpenses(MemberExpensesAct act);

        /// <summary>
        /// 记录服务手工费
        /// </summary>
        /// <param name="headSheetId"></param>
        /// <param name="customerId"></param>
        void SetShouGongFeiBooks(Guid headSheetId, Guid? customerId);

    }
}
